home *** CD-ROM | disk | FTP | other *** search
/ PC Answers 2002 January / PC Answers January 2002.7z / PC Answers January 2002.bin / graphics / freepixl / _SETUP.1 / Shade.pxl < prev    next >
Text File  |  2000-12-23  |  3KB  |  122 lines

  1. Initialize:
  2.     WinGetActive(Win$)
  3.     UseCoordinates(PIXEL)
  4.     UseBackGround(TRANSPARENT,192,192,192)
  5.     DrawBackGround
  6.     WaitInput(100)  {let NT and 95 catch up}
  7.     InfoMenu(REMOVE)
  8.     SetMenu()
  9.     WinLocate(Win$,200,100,700,580,Res)
  10.     Title$ = "Creating Color Gradients"
  11.     WinTitle(Win$, Title$)
  12.     WinGetClientRect("",cx1,cy1,cx2,cy2)
  13.  
  14.  
  15.     SetMenu("E&xit!",Leave,
  16.         ENDPOPUP,
  17.         "&Gradients",IGNORE,
  18.         "Shade &Command",ShadeCmd,
  19.         "Shade &Background",Shade2,
  20.         "Shade &Function",ShadeFn,
  21.         ENDPOPUP,
  22.         "&Help",IGNORE,
  23.         "&Concept",Concept,
  24.         "&About",About,
  25.         ENDPOPUP)
  26.     
  27. Wait_for_Input:
  28.     WaitInput()
  29.  
  30.  
  31. Leave:
  32.     End
  33.  
  34. Concept:
  35.     MessageBox(OK,1,INFORMATION,
  36. "Shaded regions are drawn, and mouse draw is enabled. Click on 
  37. the right mouse to indicate the current screen color, and to
  38. change the mouse draw pen color. 
  39.  
  40. The Shade Function demonstrates that using the DrawShadeRectangle
  41. command is faster than the same function written as a draw loop.",
  42.     "Draw Shaded Rectangles Concepts",Res)
  43.     Goto Wait_for_Input
  44.  
  45. About:
  46.     AboutUser("Drawing Color Gradients",
  47.     "Sample PiXCL 4.0 program", "")
  48.     Goto Wait_for_Input
  49.  
  50. ShadeCmd:
  51.     DrawBackground
  52.     UsePen(SOLID,1,255,255,255)
  53.     UseBrush(NULL,0,0,0)
  54.     Y1 = 10  Y2 = Y1 + 180
  55.     Y3 = Y2 + 10 Y4 = Y3 + 180
  56.     SetRightMouse(cx1,cy1,cx2,cy2,Report,X,Y)
  57.     DrawRectangle(10,Y1,200,Y2)
  58.     DrawRectangle(210,Y1,400,Y2)
  59.     DrawRectangle(10,Y3,200,Y4)
  60.     DrawRectangle(210,Y3,400,Y4)
  61.  
  62.     UsePen(SOLID,2,255,0,0)
  63.     SetDrawMouse(FOREGND)
  64.  
  65.     DrawShadeRectangle(10,Y1,200,Y2, 0,0,0, 255,0,0,TOPBOTTOM)
  66.     DrawShadeRectangle(210,Y1,400,Y2, 0,0,0, 0,255,0,TOPBOTTOM)
  67.     DrawShadeRectangle(10,Y3,200,Y4, 0,0,0, 0,0,255,TOPBOTTOM)
  68.     DrawShadeRectangle(210,Y3,400,Y4, 0,0,0, 255,255,255,TOPBOTTOM)
  69.     
  70.     WaitInput(1000)
  71.     
  72.     DrawShadeRectangle(10,Y1,200,Y2, 128,128,0, 255,0,0,BOTTOMTOP)
  73.     DrawShadeRectangle(210,Y1,400,Y2, 0,160,0, 0,255,0,BOTTOMTOP)
  74.     DrawShadeRectangle(10,Y3,200,Y4, 0,0,160, 0,255,128,BOTTOMTOP)
  75.     DrawShadeRectangle(210,Y3,400,Y4, 0,0,0, 255,255,255,BOTTOMTOP)
  76.  
  77.     Goto Wait_for_Input
  78.  
  79. Shade2:
  80.     DrawShadeRectangle(cx1,cy1,cx2,cy2, 0,0,160, 0,255,128,BOTTOMTOP)
  81.  
  82.     Goto Wait_for_Input
  83.  
  84. Report:
  85.     UseBrush(SOLID,192,192,192)
  86.     UsePen(NULL,1,0,0,0)
  87.     DrawRectangle(410,10,500,100)
  88.     GetPixel(X,Y,R,G,B,Res)
  89.     DrawNumber(410,10,X)  DrawNumber(460,10,Y)
  90.     DrawNumber(420,30,R)
  91.     DrawNumber(420,50,G)
  92.     DrawNumber(420,70,B)
  93.     UsePen(SOLID,1,R,G,B)
  94.     Goto Wait_for_Input
  95.  
  96.  
  97. { Draw_Blue_Shade: create a shaded background, black at top }
  98. ShadeFn:
  99.     Set Counter = 1
  100.     Set Pen_Colour = 0
  101. InitLoop_0:
  102.     Set Counter = 0
  103.     Set Br_Colour = 7
  104.     Set yY1 = cy1
  105.     While Counter <= cy2
  106.         UsePen(SOLID,1,0,0,Br_Colour)
  107.         yY1 = Counter
  108.         DrawLine(cx1,yY1,cx2,yY1)
  109.         If Br_Colour < 255
  110.         Br_Colour++
  111.         Else
  112.         Br_Colour = 255
  113.         Endif
  114.         Counter++
  115.     EndWhile
  116.  
  117.     Goto Wait_for_Input
  118.  
  119.  
  120.  
  121.  
  122.